'\" te
.\"  Copyright (c) 1983 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution. Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
.TH NEWFS 8 "Mar 1, 2007"
.SH NAME
newfs \- construct a UFS file system
.SH SYNOPSIS
.LP
.nf
\fBnewfs\fR [\fB-NSBTv\fR] [\fImkfs-options\fR] \fIraw-device\fR
.fi

.SH DESCRIPTION
.sp
.LP
\fBnewfs\fR is a "friendly" front-end to the \fBmkfs\fR(8) program for making
\fBUFS\fR file systems on disk partitions. \fBnewfs\fR calculates the
appropriate parameters to use and calls \fBmkfs\fR.
.sp
.LP
If run interactively (that is, standard input is a tty), \fBnewfs\fR prompts
for confirmation before making the file system.
.sp
.LP
If the \fB-N\fR option is not specified and the inodes of the device are not
randomized, \fBnewfs\fR calls \fBfsirand\fR(8).
.sp
.LP
You must be super-user or have appropriate write privileges to use this
command, except when creating a \fBUFS\fR file system on a \fIdiskette\fR. See
\fBEXAMPLES\fR.
.SS "Creating a Multiterabyte UFS File System"
.sp
.LP
Keep the following limitations in mind when creating a multiterabyte UFS file
system:
.RS +4
.TP
.ie t \(bu
.el o
\fInbpi\fR is set to 1 Mbyte unless you specifically set it higher. You cannot
set \fInbpi\fR lower than 1 Mbyte on a multiterabyte UFS file system.
.RE
.RS +4
.TP
.ie t \(bu
.el o
\fIfragsize\fR is set equal to \fIbsize\fR.
.RE
.SH OPTIONS
.sp
.LP
The following options are supported:
.sp
.ne 2
.na
\fB\fB-N\fR\fR
.ad
.sp .6
.RS 4n
Print out the file system parameters that would be used to create the file
system without actually creating the file system. \fBfsirand\fR(8) is not
called here.
.RE

.sp
.ne 2
.na
\fB\fB-S\fR\fR
.ad
.sp .6
.RS 4n
Sends to stdout a human-readable version of the superblock that would be used
to create a filesystem with the specified configuration parameters.
.RE

.sp
.ne 2
.na
\fB\fB-B\fR\fR
.ad
.sp .6
.RS 4n
Sends to stdout a binary (machine-readable) version of the superblock that
would be used to create a filesystem with the specified configuration
parameters.
.RE

.sp
.ne 2
.na
\fB\fB-T\fR\fR
.ad
.sp .6
.RS 4n
Set the parameters of the file system to allow eventual growth to over a
terabyte in total file system size. This option sets \fIfragsize\fR to be the
same as \fIbsize\fR, and sets \fInbpi\fR to 1 Mbyte, unless the \fB-i\fR option
is used to make it even larger. If you use the \fB-f\fR or \fB-i\fR options to
specify a \fIfragsize\fR or \fInbpi\fR that is incompatible with this option,
the user-supplied value of \fIfragsize\fR or \fInbpi\fR is ignored.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.sp .6
.RS 4n
Verbose. \fBnewfs\fR prints out its actions, including the parameters passed to
\fBmkfs\fR.
.RE

.sp
.ne 2
.na
\fB\fImkfs-options\fR\fR
.ad
.sp .6
.RS 4n
Options that override the default parameters are:
.sp
.ne 2
.na
\fB\fB-a\fR \fIapc\fR\fR
.ad
.sp .6
.RS 4n
The number of alternate sectors per cylinder to reserve for bad block
replacement for SCSI devices only. The default is \fB0\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fB-b\fR \fIbsize\fR\fR
.ad
.sp .6
.RS 4n
The logical block size of the file system in bytes, either 4096 or 8192. The
default is \fB8192\fR. The sun4u architecture does not support the \fB4096\fR
block size.
.RE

.sp
.ne 2
.na
\fB\fB-c\fR \fIcgsize\fR\fR
.ad
.sp .6
.RS 4n
The number of cylinders per cylinder group, ranging from \fB16\fR to \fB256\fR.
The default is calculated by dividing the number of sectors in the file system
by the number of sectors in a gigabyte. Then, the result is multiplied by
\fB32\fR. The default value is always between \fB16\fR and \fB256\fR.
.sp
\fBmkfs\fR can override this value. See \fBmkfs_ufs\fR(8) for details.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR \fImaxcontig\fR\fR
.ad
.sp .6
.RS 4n
The maximum number of logical blocks, belonging to one file, that are allocated
contiguously. The default is calculated as follows:
.sp
.in +2
.nf
\fBmaxcontig =\fR \fIdisk drive maximum transfer size / disk block size\fR
.fi
.in -2
.sp

If the disk drive's maximum transfer size cannot be determined, the default
value for \fBmaxcontig\fR is calculated from kernel parameters as follows:
.sp
If \fBmaxphys\fR is less than \fBufs_maxmaxphys\fR, which is typically 1 Mbyte,
then \fBmaxcontig\fR is set to \fBmaxphys\fR. Otherwise, \fBmaxcontig\fR is set
to \fBufs_maxmaxphys\fR.
.sp
You can set \fBmaxcontig\fR to any positive integer value.
.sp
The actual value will be the lesser of what has been specified and what the
hardware supports.
.sp
You can subsequently change this parameter by using \fBtunefs\fR(8).
.RE

.sp
.ne 2
.na
\fB\fB-d\fR \fIgap\fR\fR
.ad
.sp .6
.RS 4n
Rotational delay. This option is obsolete in the Solaris 10 release. The value
is always set to \fB0\fR, regardless of the input value.
.RE

.sp
.ne 2
.na
\fB\fB-f\fR \fIfragsize\fR\fR
.ad
.sp .6
.RS 4n
The smallest amount of disk space in bytes that can be allocated to a file.
\fBfragsize\fR must be a power of 2 divisor of \fBbsize\fR, where:
.sp
\fBbsize\fR / \fBfragsize\fR is 1, 2, 4, or 8.
.sp
This means that if the logical block size is \fB4096\fR, legal values for
\fBfragsize\fR are \fB512\fR, \fB1024\fR, \fB2048\fR, and \fB4096\fR. When the
logical block size is \fB8192\fR, legal values are \fB1024\fR, \fB2048\fR,
\fB4096\fR, and \fB8192\fR. The default value is \fB1024\fR.
.sp
For file systems greater than 1 terabyte or for file systems created with the
\fB-T\fR option, \fBfragsize\fR is forced to match block size (\fBbsize\fR).
.RE

.sp
.ne 2
.na
\fB\fB-i\fR \fInbpi\fR\fR
.ad
.sp .6
.RS 4n
The number of bytes per inode, which specifies the density of inodes in the
file system. The number is divided into the total size of the file system to
determine the number of inodes to create.
.sp
This value should reflect the expected average size of files in the file
system. If fewer inodes are desired, a larger number should be used. To create
more inodes, a smaller number should be given. The default for \fInbpi\fR is as
follows:
.sp
.in +2
.nf
Disk size                 Density

Less than 1GB             2048
Less than 2GB             4096
Less than 3GB             6144
3GB to 1 Tbyte            8192
Greater than 1 Tbyte
   or created with -T     1048576
.fi
.in -2
.sp

The number of inodes can increase if the file system is expanded with the
\fBgrowfs\fR command.
.RE

.sp
.ne 2
.na
\fB\fB-m\fR \fIfree\fR\fR
.ad
.sp .6
.RS 4n
The minimum percentage of free space to maintain in the file system, between 0%
and 99%, inclusively. This space is off-limits to users. Once the file system
is filled to this threshold, only the super-user can continue writing to the
file system.
.sp
The default is ((64 Mbytes/partition size) * 100), rounded down to the nearest
integer and limited between 1% and 10%, inclusively.
.sp
This parameter can be subsequently changed using the \fBtunefs\fR(8) command.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR \fInrpos\fR\fR
.ad
.sp .6
.RS 4n
The number of different rotational positions in which to divide a cylinder
group. The default is \fB8\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fB-o\fR \fIspace\fR\||\|\fItime\fR\fR
.ad
.sp .6
.RS 4n
The file system can either be instructed to try to minimize the \fBtime\fR
spent allocating blocks, or to try to minimize the \fBspace\fR fragmentation on
the disk. The default is \fItime\fR.
.sp
This parameter can subsequently be changed with the \fBtunefs\fR(8) command.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR \fIrpm\fR\fR
.ad
.sp .6
.RS 4n
The rotational speed of the disk in revolutions per minute. The default is
driver- or device-specific.
.sp
Note that you specify \fIrpm\fR for \fBnewfs\fR and \fIrps\fR for \fBmkfs\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fIsize\fR\fR
.ad
.sp .6
.RS 4n
The size of the file system in sectors. The default is to use the entire
partition.
.RE

.sp
.ne 2
.na
\fB\fB-t\fR \fIntrack\fR\fR
.ad
.sp .6
.RS 4n
The number of tracks per cylinder on the disk. The default is taken from the
disk label.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.RE

.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIraw-device\fR\fR
.ad
.sp .6
.RS 4n
The name of a raw special device residing in the \fB/dev\fR directory (for
example, \fB/dev/rdsk/c0t0d0s6\fR) on which to create the file system.
.RE

.SH USAGE
.sp
.LP
See \fBlargefile\fR(7) for the description of the behavior of \fBnewfs\fR when
encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
.SH EXAMPLES
.LP
\fBExample 1 \fRDisplaying the Parameters for the Raw Special Device
.sp
.LP
The following example verbosely displays the parameters for the raw special
device, \fBc0t0d0s6\fR. It does not actually create a new file system:

.sp
.in +2
.nf
example# newfs \fB-Nv\fR /dev/rdsk/c0t0d0s6
mkfs \fB-F\fR ufs \fB-o\fR N /dev/rdsk/c0t0d0s6 1112940 54 15 8192 1024 16 10 60
2048 t 0 \(mi1 8 /dev/rdsk/c0t0d0s6: 1112940 sectors in
1374 cylinders of 15 tracks, 54 sectors 569.8MB in 86 cyl
groups (16 c/g, 6.64MB/g, 3072 i/g) super-block backups
(for fsck \fB-b\fR #) at:
32, 13056, 26080, 39104, 52128, 65152, 78176, 91200, 104224, .\|.\|.
.fi
.in -2
.sp

.LP
\fBExample 2 \fRCreating a \fBUFS\fR File System
.sp
.LP
The following example creates a \fBUFS\fR file system on a diskette that is
managed by a volume manager that makes use of the mount point \fB/vol\fR.

.sp
.in +2
.nf
example% newfs /vol/dev/aliases/floppy0
newfs: construct a new file system /vol/dev/aliases/floppy0: (y/n)? y
/vol/dev/aliases/floppy0: 2880 sectors in 80 cylinders of 2 tracks,
18 sectors 1.4MB in 5 cyl groups (16 c/g, 0.28MB/g, 128 i/g)
super-block backups (for fsck \fB-F\fR ufs \fB-o\fR b=#) at:
32, 640, 1184, 1792, 2336, .\|.\|.
.fi
.in -2
.sp

.LP
\fBExample 3 \fRCreating a \fBUFS\fR File System That Will Eventually Be Grown
to a Multiterabyte UFS File System
.sp
.LP
The following example creates a \fBUFS\fR file system that will eventually be
grown to a multiterabyte UFS file system.

.sp
.LP
This command creates a 800-Gbyte file system on the volume,
\fB/dev/md/rdsk/d99\fR.

.sp
.in +2
.nf
# newfs -T /dev/md/rdsk/d99
newfs: construct a new file system /dev/md/rdsk/d99: (y/n)? y
   /dev/md/rdsk/d99: 1677754368 sectors in 45512 cylinders of
   144 tracks, 256 sectors
   819216.0MB in 1821 cyl groups (25 c/g, 450.00MB/g, 448 i/g) .\|.\|.
.fi
.in -2
.sp

.sp
.LP
Then, if you increase the volume size for this file system, you can use the
\fBgrowfs\fR command to expand the file system. The file system is grown to 1.2
terabytes in this example:

.sp
.in +2
.nf
# growfs -v /dev/md/rdsk/d99
/usr/lib/fs/ufs/mkfs -G /dev/md/rdsk/d99 2516631552 /dev/md/rdsk/d99:
   2516631552 sectors in 68268 cylinders of 144 tracks, 256  sectors
   1228824.0MB in 2731 cyl groups (25 c/g, 450.00MB/g, 448 i/g).\|.\|.
.fi
.in -2
.sp

.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.sp .6
.RS 4n
The operation was successful.
.RE

.sp
.ne 2
.na
\fB\fB1\fR, \fB10\fR\fR
.ad
.sp .6
.RS 4n
Usage error or internal error. A message is output to \fBSTDERR\fR explaining
the error.
.RE

.sp
.LP
Other exit values may be returned by \fBmkfs\fR(8), which is called by
\fBnewfs\fR.
.SH SEE ALSO
.sp
.LP
.BR ufs (4FS),
.BR attributes (7),
.BR largefile (7),
.BR fsck (8),
.BR fsck_ufs (8),
.BR fsirand (8),
.BR mkfs (8),
.BR mkfs_ufs (8),
.BR tunefs (8)
.SH DIAGNOSTICS
.sp
.ne 2
.na
\fB\fBnewfs: No such file or directory\fR\fR
.ad
.sp .6
.RS 4n
The device specified does not exist, or a disk partition was not specified.
.RE

.sp
.ne 2
.na
\fB\fIspecial\fR\fB: cannot open\fR\fR
.ad
.sp .6
.RS 4n
You must write access to the device to use this command.
.RE

